home *** CD-ROM | disk | FTP | other *** search
- /*—————————————————————————————————————————————————————————————————————————————————————
- #
- # Display Flip FKey 1.0.
- #
- # Written by: Eric Anderson
- # email: eric3@apple.com
- #
- # Display Manager sample code using FKey
- #
- # • Display Flip FKEY=0
- #
- # DMFkey.c - C Code
- #
- # Copyright © 1996 Eric3 Anderson
- # Free to distribute, modify, fold, spindle, and mutilate. Whatever.
- #
- # 2/10/96 ewa New today.
- #
- #
- #
- # Components: DMFkey.c
- # RequestVideo.c
- # RequestVideo.h
- #
- # Uses the kool new Display Manager 2.0 (found in System 7.5.2 and later, or in
- # the version 2.0 Display Enabler system extension which ships with the new
- # AppleVision multisync displays) to change the monitor screen resolution
- # the specified HxV resolutions.
- #
- # This FKey will flip between 640x480 and BIG.
- # BIG is up to 2000x2000 if your monitor supports it.
- #
- # For information on the use of the RequestVideo sample code, please refer to the
- # documentation found in the Display Manager Development Kit, or just look at the
- # code and comments to figure it out.
- —————————————————————————————————————————————————————————————————————————————————————*/
-
- #define minHorizontalRequest 640
- #define minVerticalRequest 480
-
- #define maxHorizontalRequest 2000
- #define maxVerticalRequest 2000
-
- #define bitDepthRequest 32
-
- #include <Types.h>
- #include <Quickdraw.h>
-
- #include "RequestVideo.h" // The code that does the real work
-
- struct INITGlobals {
- QDGlobals initQDGlobals; // FKEY's own private QDGlobals
- unsigned long initQDBase; // FKEY's global base
- };
- typedef struct INITGlobals INITGlobals;
-
- main()
- {
- VideoRequestRec requestRec;
- INITGlobals qdGlobs;
- long oldA5;
- unsigned long theHorizontalRequest;
- unsigned long theVerticalRequest;
-
- oldA5 = SetA5((long) &qdGlobs.initQDBase);
- InitGraf((Ptr) &qdGlobs.initQDGlobals.thePort);
-
- theHorizontalRequest = minHorizontalRequest;
- theVerticalRequest = minVerticalRequest;
-
- requestRec.screenDevice = GetMainDevice ();
- requestRec.reqHorizontal = (*(*(requestRec.screenDevice))->gdPMap)->bounds.right; // main screen is always zero offset (bounds.left == 0)
- requestRec.reqVertical = (*(*(requestRec.screenDevice))->gdPMap)->bounds.bottom; // main screen is always zero offset (bounds.top == 0)
- if (requestRec.reqHorizontal == minHorizontalRequest || requestRec.reqVertical == minVerticalRequest) // on a small screen now?
- {
- theHorizontalRequest = maxHorizontalRequest;
- theVerticalRequest = maxVerticalRequest;
- }
-
- requestRec.reqBitDepth = bitDepthRequest; // bit depth request
- requestRec.reqHorizontal = theHorizontalRequest; // H request
- requestRec.reqVertical = theVerticalRequest; // V request
- requestRec.displayMode = nil; // must init to nil
- requestRec.depthMode = nil; // must init to nil
- requestRec.requestFlags = 0;
- if (noErr == RVRequestVideoSetting(&requestRec))
- {
- RVSetVideoRequest (&requestRec);
- }
- SetA5(oldA5);
- return (noErr);
- }
-